<!-- Teacher_TeachTabController.html -->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>教师学习tab页</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
		<style>
			body {
				background-color: #fff;
			}
			#footer {
				background-color: #fff;
				height: 52px;
				overflow: hidden;
			}
			#footer ul li {
				padding-top: 32px;
				padding-bottom: 4px;
				background: url() no-repeat center 4px;
				background-size: auto 24px;
				text-align: center;
				color: #979797;
				font-size: 12px;
			}
			#footer ul li.active {
				color: #18b4ed;
			}
			#footer ul li:nth-child(1) {
				background-image: url(../../icon/icon_kecheng1.png);
			}
			#footer ul li:nth-child(2) {
				background-image: url(../../image/icon_tab_teach_normal.png);
			}
			#footer ul li:nth-child(3) {
				background-image: url(../../icon/icon_ketang.png);
			}
			#footer ul li:nth-child(4) {
				background-image: url(../../image/icon_tab_plan_normal.png);
			}
			#footer ul li:nth-child(1).active {
				background-image: url(../../icon/icon_kecheng2.png);
			}
			#footer ul li:nth-child(2).active {
				background-image: url(../../image/icon_tab_teach_selected.png);
			}
			#footer ul li:nth-child(3).active {
				background-image: url(../../icon/icon_ketang1.png);
			}
			#footer ul li:nth-child(4).active {
				background-image: url(../../image/icon_tab_plan_selected.png);
			}
		</style>
	</head>
	<body>
		<div id="wrap" class="flex-wrap flex-vertical">
			<div id="main" class="flex-con"></div>
			<div id="footer" class="border-t">
				<ul class="flex-wrap" >
					<li tapmode="hover" onclick="randomSwitchBtn(this, 0 );" class="flex-con active" >
						课程
					</li>
					<li tapmode="hover" onclick="randomSwitchBtn(this, 1 );" class="flex-con" >
						授课
					</li>
					<li tapmode="hover" onclick="randomSwitchBtn(this, 2 );" class="flex-con" >
						课堂
					</li>
					<li tapmode="hover" onclick="randomSwitchBtn(this, 3 );" class="flex-con" >
						计划
					</li>
				</ul>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript">
		apiready = function(){
		    setupGroup();
		}
		function setupGroup(){
			var eHeaderLis = $api.domAll('header li'), frames = new Array();
			//添加学习页 
			frames.push({
				name : 'Student_studyWindow',
				url : '../Study/Student_studyWindow.html',
				bgColor : '#fff',
				bounces : false,
				vScrollBarEnabled : false,
				pageParam : {
					sourceurl : api.pageParam.sourceurl,
					sourcetitle : api.pageParam.sourcetitle,
					type : 'Certification',
					ifteacherstudy:'true',//是否是老师端学习
				}
			});
			//添加授课页 
			frames.push({
				name : 'Teacher_StudyCourseListWindow',
				url : 'Teacher_StudyCourseListWindow.html',
				bgColor : '#fff',
				bounces : false,
				vScrollBarEnabled : false
			});
			//课堂
			frames.push({
				name : 'Classrom_index',
				url : '../Teacher_Classroom/Classrom_index.html',
				bgColor : '#fff',
				bounces : false,
				vScrollBarEnabled : false
			});
			//添加学习计划列表页
			frames.push({
				name : 'StudyPlanList_Win',
				url : '../StudyPlanManage/StudyPlanList_Win.html',
				bgColor : '#fff',
				bounces : false,
				vScrollBarEnabled : false
			});
			var bottomH = $api.byId('footer').offsetHeight;
			//52
			var y = 0;
			var h = api.winHeight - bottomH;
			api.openFrameGroup({
				name : 'TeacherStudyFrameGroup',
				background : '#fff',
				scrollEnabled : false,
				rect : {
					x : 0,
					y : y,
					w : api.winWidth,
					h : h
				},
				index : 0,
				frames : frames,
				preload : 0
			}, function(ret, err) {
			});
		} 
		// 随意切换按钮
		function randomSwitchBtn(tag, num) {
			//设置tabbar选中下标
			$api.setStorage('tabbarSelectedIndex', num);
			var eFootLis = $api.domAll('#footer li'), eHeaderLis = $api.domAll('header li'), index = 0;
			for (var i = 0, len = eFootLis.length; i < len; i++) {
				if (tag == eFootLis[i]) {
					index = i;
				} else {
					$api.removeCls(eFootLis[i], 'active');
					$api.removeCls(eHeaderLis[i], 'active');
				}
			}
			$api.addCls(eFootLis[index], 'active');
			$api.addCls(eHeaderLis[index], 'active');
			api.setFrameGroupIndex({
				name : 'TeacherStudyFrameGroup',
				index : index
			});
			if (num == 0) {
				api.sendEvent({
					name : 'showCourseFrameGroupNotifi'
				});
			} else {
				api.sendEvent({
					name : 'hideCourseFrameGroupNotifi'
				});
			}
			if (num == 1) {
				api.sendEvent({
					name : 'showTeachCourseFrameNotifi'
				});
			} else {
				api.sendEvent({
					name : 'hideTeachCourseFrameNotifi'
				});
			}
			if (num == 2) {
				api.sendEvent({
					name : 'showClassroomFrameNotifi'
				});
			} else {
				api.sendEvent({
					name : 'hideClassroomFrameNotifi'
				});
			}
			if (num == 3) {
				api.sendEvent({
					name : 'showPlanListFrameNotifi'
				});
			} else {
				api.sendEvent({
					name : 'hidePlanListFrameNotifi'
				});
			}
		}
	</script>
</html>